﻿using SharpDepend.Datatypes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ZquenceStudio3Host.Graphics.Components;
using ZquenceStudio3Host.Graphics.GUI;

namespace DefaultDspPlugins.UI.Common.Modulizer.Engine.GUIv2.Editors
{
    internal abstract class BaseUIEditorWindow : Panel
    {
        private Button Close;
        
        public BaseUIEditorWindow(BasicGuiManager engineCore) : base(engineCore)
        {
            OnComponentInitialize();

            // Delete.
            Close = new Button(engineCore, true);
            Close.DimensionInProcent = true;
            Close.Width = 10;
            Close.Height = 10;
            Close.X = 90;
            Close.Y = 0;
            Close.setText("X");
            Close.SetButtonColor(Color.Red);
            Close.OnClicked += Close_OnClicked;
            AddPart(Close);
        }

        protected abstract void OnComponentInitialize();

        private void Close_OnClicked(object sender, double x, double y, int id)
        {
            Hide();
        }

        public void Show()
        {
            Visible = true;
        }

        public void Hide()
        {
            Visible = false;
        }
    }
}
